CFLAGS=-g -Wall
#CROSS_COMPILE=arm-linux-
#CROSS_COMPILE=
CC=$(CROSS_COMPILE)gcc
AR=$(CROSS_COMPILE)ar
RANLIB=$(CROSS_COMPILE)ranlib
LIBS=-L./ -lcgic


NFSBOA_CGIBIN=~/nfs/rootfs/boa/cgi-bin

all: libcgic.a cgictest.cgi mycgitest.cgi capture

install: libcgic.a
	cp libcgic.a /usr/local/lib
	cp cgic.h /usr/local/include
	@echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include.

libcgic.a: cgic.o cgic.h
	rm -f libcgic.a
	$(AR) rc libcgic.a cgic.o
	$(RANLIB) libcgic.a

#mingw32 and cygwin users: replace .cgi with .exe

cgictest.cgi: cgictest.o libcgic.a
	$(CC) cgictest.o -o cgictest.cgi ${LIBS}

capture: capture.o libcgic.a
	$(CC) capture.o -o capture ${LIBS}

mycgitest.cgi: mycgitest.o libcgic.a
	$(CC) mycgitest.o -o mycgitest.cgi ${LIBS}

nfsdeal:
	mv *.o ./obj/
	mv *.a *.cgi capture ./cgi-bin/
	sudo cp ./cgi-bin/* $(NFSBOA_CGIBIN)

clean:
	rm -f *.o *.a cgictest.cgi capture
	rm -f ./cgi-bin/* ./obj/*

